//
//  ApiSupport.m
//  gdemm
//
//  Created by yongwu on 15/12/2.
//  Copyright © 2015年 goldensoft. All rights reserved.
//

#import "ApiSupport.h"
#import "KeyChain.h"
@implementation ApiSupport
+(NSString*)getDeptreeUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if ([StringUtil isEmpty:servAddr]) {
        return nil;
    }
    
    return [NSString stringWithFormat:@"http://%@/Mdm/AndroidApi/depTree",servAddr];
}

+(NSString*)getUpdateUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    return [NSString stringWithFormat:@"http://%@/emm/api/version.php?type=android",servAddr];
}
+(NSString*)getUserLoginUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    
    return [NSString stringWithFormat:@"http://%@/Mdm/AndroidApi/userLogin",servAddr];
}
+(NSString*)getDeviceRegistUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    
    return [NSString stringWithFormat:@"http://%@/Mdm/AndroidApi/deviceReg",servAddr];
}
+(NSString*)getExamineUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
     NSString *userGuid = [[UserDefaultsUtil shareInstance]getString:LC_USERGUID];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    //设置参数
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"userGUID"] = userGuid;
    params[@"type"] = @"ios";
    //获取策略文件的url
    
    return [HttpUtil buildUrl:[NSString stringWithFormat:@"http://%@/Mdm/Api/getSafeCheck",servAddr] WithParams:params];
}
+(NSString*)getFileSyncUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    
    //获取策略文件的url
    return [NSString stringWithFormat:@"http://%@//Mdm/AndroidApi/fileSync",servAddr];
}
/*云盘文件删除*/
+(NSString*)getDeleteFileUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    return [NSString stringWithFormat:@"http://%@//Mdm/AndroidApi/fileSync",servAddr];
}
+(NSString*)getChangeUserInfoUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    return [NSString stringWithFormat:@"http://%@/Mdm/AndroidApi/changUserInfo",servAddr];
}
+(NSString*)getMessageSyncUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    
    //获取参数
    NSString *userGuid = [[UserDefaultsUtil shareInstance]getString:LC_USERGUID];
    if ([StringUtil isEmpty:userGuid]) {
        return nil;
    }
    //设置参数
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"userGUID"] = userGuid;
    
     return [HttpUtil buildUrl:[NSString stringWithFormat:@"http://%@//Mdm/AndroidApi/remoteNotice",servAddr] WithParams:params]; 
}
//获取策略文件url
+(NSString*)getPolicyUrl{
    //获取服务器IP
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    //获取参数
    NSString *userGuid = [[UserDefaultsUtil shareInstance]getString:LC_USERGUID];
    if ([StringUtil isEmpty:userGuid]) {
        return nil;
    }
    //设置参数
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"userGUID"] = userGuid;
    params[@"type"] = @"ios";
    //获取策略文件的url
    
    return [HttpUtil buildUrl:[NSString stringWithFormat:@"http://%@/Mdm/Api/getPolicy",servAddr] WithParams:params];
}

//获取区域策略文件url
+ (NSString *)getLocationPolicyUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    //获取参数
    NSString *userGuid = [[UserDefaultsUtil shareInstance]getString:LC_USERGUID];
    if ([StringUtil isEmpty:userGuid]) {
        return nil;
    }
    
    return [NSString stringWithFormat:@"http://%@/Mdm/Api/getLocationPolicyApi?type=ios",servAddr];
}

//获取用户注册的url
+(NSString*)getUserRegisterUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
     return [NSString stringWithFormat:@"http://%@/Mdm/AndroidApi/userRegister",servAddr];
}

//获取设备注册信息提交的url
+(NSString *)getDeviceInfo{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    //return [NSString stringWithFormat:@"http://%@/Mdm/IosApi/hardWareInfo",servAddr];
    return [NSString stringWithFormat:@"http://%@/Mdm/IosApi/getIosDevStatus",servAddr];
}

//获取设备软件信息提交url
+ (NSString *)getSoftwareUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    return [NSString stringWithFormat:@"http://%@/Mdm/AndroidApi/softWareInfo",servAddr];
}

/*调教本地信息(定位)到服务器*/
+ (NSString *)submitLocationInfoUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if (servAddr == nil || [servAddr isEqualToString:@""]) {
        return nil;
    }
    
    return [NSString stringWithFormat:@"http://%@/emm/api/userLocation.php",servAddr];
}

//提交评测结果到服务器
+ (NSString *)submitSafeCheckInfoUrl{
    
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if (servAddr == nil || [servAddr isEqualToString:@""]) {
        return nil;
    }
    return [NSString stringWithFormat:@"http://%@/Mdm/AndroidApi/safeCheck",servAddr];
}

//请求描述文件生成接口
+ (NSString *)generateMobileConfigUrl{

    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if (servAddr == nil || [servAddr isEqualToString:@""]) {
        return nil;
    }
    
    return [NSString stringWithFormat:@"http://%@/Mdm/IosApi/desFileMake",servAddr];
}

//安装描述文件接口
+(NSString *)installMobileConfigUrl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if (servAddr == nil || [servAddr isEqualToString:@""]) {
        return nil;
    }
    
    //设置参数
    NSString *uuid = [KeyChain getUUID];
    
    //获取策略文件的url
    return [NSString stringWithFormat:@"http://%@/Resource/MdmIosConfig/%@.mobileconfig",servAddr,uuid];
}

//获取UDID接口
+(NSString *)saveUniqueUDIDURl{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if (servAddr == nil || [servAddr isEqualToString:@""]) {
        return nil;
    }
    //设置参数
    NSString *uuid = [KeyChain getUUID];
    return [NSString stringWithFormat:@"http://%@/Mdm/IosApi/getIosUdid/uuid/%@",servAddr,uuid];
}

//上网行为分析接口
+(NSString *)browsingBehaviorURL{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    return [NSString stringWithFormat:@"http://%@/Mdm/AndroidApi/browseApprove",servAddr];
}

+(NSString *)getAppStoreList{
    NSString *servAddr = [[UserDefaultsUtil shareInstance]getString:LC_SERVADDR];
    if([StringUtil isEmpty:servAddr]){
        return nil;
    }
    return [NSString stringWithFormat:@"http://%@/index.php/Mdm/Api/getAppStoreList",servAddr];
}
@end
